'use strict';

const wechat = require("./middleware/wechat");

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, io } = app;
  // router.get('/', controller.home.index);
  router.post('/login', controller.user.login);
  router.post('/register', controller.user.register);
  // 客户端
  //  router.get('/list', controller.home.list);
  // 管理系统
  router.get('/admin/list', controller.admin.list);
  router.post('/admin/edit', controller.admin.edit);
  router.post('/admin/add', controller.admin.add);
  router.post('/admin/delete', controller.admin.delete);
  // socket.io
  io.of('/').route('exchange', io.controller.nsp.exchange);

  // 微信
  app.get('/wechat', wechat)
  app.post('/wechat', wechat)
  app.get('/weChatOAuth', app.controller.weChatOAuth.getOAuth)
  app.get('/getFollowers', app.controller.weChatOAuth.getFollowers)
  app.get('/getInfo', app.controller.weChatOAuth.getInfo)
};